#include "dbmgr.h"
#include <stdio.h>
#include <memory.h>


c_dbMgr::c_dbMgr(){
}


c_dbMgr::~c_dbMgr(){
	if( p_user_head != NULL ){
		delete p_user_head;
	}
}


i32 c_dbMgr::init_dbMgr(){
	p_user_head = new c_user((c8*)"usrid1",(c8*)"usrpw1");
	put_userlist();
	add_user((c8*)"userid2",(c8*)"userpw2");
	put_userlist();
}

i32 c_dbMgr::add_user( c8* name , c8* pw){
	c_user **ppusr;
	ppusr = &p_user_head;
	while( (*ppusr) != NULL ){
		ppusr = &(*ppusr)->next_node;
	}
	(*ppusr) = new c_user(name,pw);
}
i32 c_dbMgr::put_userlist(){
	c_user* pusr;
	pusr = this->p_user_head;
	while( pusr != NULL){
		pusr->put_user();
		pusr = pusr->next_node;
	}
}



